/*
** list.c for  in /home/lucas/projet/philosophe/laidfilauxzauphe
** 
** Made by Lucas Stefas
** Login   <stefas_l@epitech.net>
** 
** Started on  Sat Apr 30 10:05:44 2011 Lucas Stefas
** Last update Sat Apr 30 10:05:47 2011 Lucas Stefas
*/

#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "plsp.h"

lifo	*addinlist(lifo *list, char *str)
{
  lifo	*newlist;
  
  if (!list->str)
    {
      list->str = str;
      list->next = NULL;
      return (list);
    }
  else
    {
      if ((newlist = malloc(sizeof(lifo))) == NULL)
	{
	  fprintf(stderr, "Error: %s\n", strerror(errno));
	  exit(EXIT_FAILURE);
	}
      newlist->str = str;
      newlist->next = list;
      return (newlist);
    }
}

lifo	*popelem(lifo *list)
{
  lifo	*tmp = list;

  list = list->next;
  free(tmp);
  return (list);
}
